#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <math.h>
#include "tlv320aic31.h"


int main(int argc,char* argv[])
{
	int dev;
	Audio_Ctrl audio_ctrl;
	
	dev = open("/dev/tlv320aic31", O_RDONLY);
	if (dev <= 0) {
		printf("tlv320aic31 device open fail\n");
		exit(0);
	}
	printf("dev = %d\n", dev);

	//ioctl(dev, TLV320AIC31_REG_DUMP);
/*
	#define	MIC_ON	1
	#define	MIC_OFF	1
	#ifdef MIC_SWITCH
		// mic on
		audio_ctrl.ctrl_mode = MIC_ON;
		audio_ctrl.input_level = 0x0;
		audio_ctrl.if_powerup = 1;
		audio_ctrl.audio_in_out = 0;
		//ioctl(dev,MIC_SWITCH, &audio_ctrl); 
	#else
		// mic off
		audio_ctrl.ctrl_mode = MIC_OFF;
		audio_ctrl.input_level = 0xf;
		audio_ctrl.if_powerup = 0;
		audio_ctrl.audio_in_out = 0;
		//ioctl(dev,MIC_SWITCH, &audio_ctrl); 
	#endif
*/

	ioctl(dev, TLV320AIC31_REG_DUMP, &audio_ctrl);
	ioctl(dev,MIC_SWITCH_ON, &audio_ctrl); 
	ioctl(dev,MIC_SWITCH_OFF, &audio_ctrl); 



	close(dev);

	return 0;
}

